<template>
  <view class="company-introduction-container">
    <!-- 标题 -->
    <view class="header">
      <text class="title">编辑公司介绍</text>
    </view>

    <!-- 提示 -->
    <view class="tip">
      <text>介绍一下公司整体情况，帮助求职者了解贵司。</text>
    </view>

    <!-- 公司简介 -->
    <view class="section">
      <text class="section-title">公司简介</text>
      <textarea
        v-model="companyIntroduction"
        placeholder="请输入公司简介"
        class="input"
      ></textarea>
    </view>

    <!-- 保存按钮 -->
    <view class="save-button-container">
      <button class="save-button" @click="saveIntroduction">保存</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      companyIntroduction: "", // 公司简介内容
    };
  },
  methods: {
    // 保存公司简介
    saveIntroduction() {
      if (!this.companyIntroduction.trim()) {
        uni.showToast({
          title: "请输入公司简介",
          icon: "none",
        });
        return;
      }

      // 返回上一页并传递数据
      const eventChannel = this.getOpenerEventChannel();
      eventChannel.emit("updateCompanyIntroduction", this.companyIntroduction);

      uni.navigateBack();
    },
  },
};
</script>

<style scoped>
.company-introduction-container {
  padding: 20px;
  background-color: #fff;
}

.header {
  margin-bottom: 10px;
}

.title {
  font-size: 18px;
  font-weight: bold;
  color: #151515;
}

.tip {
  margin-bottom: 20px;
}

.tip text {
  font-size: 14px;
  color: #666;
}

.section {
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  color: #151515;
  display: block;
  margin-bottom: 10px;
}

.input {
  width: 100%;
  height: 200px;
  padding: 10px;
  font-size: 14px;
  line-height: 1.5;
}

.save-button-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  padding: 10px 20px;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.save-button {
  width: 100%;
  height: 80rpx;
  line-height: 80rpx;
  background: linear-gradient(90deg, #9A9AFF 0%, #D6D6FE 100%);
  border-radius: 32px;
  font-size: 32rpx;
  color: #fff;
  text-align: center;
}
</style>